package com.beiding.exception;

import com.beiding.pojo.Error;

public class RegisterException extends RuntimeException {

    private String message;
    private String field;

    public RegisterException(String field, String message) {
        this.field = field + "_error";
        this.message=message;
    }

    public String getField() {
        return field;
    }

    @Override
    public String getMessage() {
        return message;
    }

    public RegisterException message(String message){
        this.message = message;
        return this;
    }

    public Error toError()
    {
        return new Error(field, message);
    }

}
